this function will return the size of folder with byte format

======================================================

function getFolderSize($dir){
	$odir = opendir($dir);
	$size = 0;
	while(($file = readdir($odir))!==false){
		if(!in_array($file,array(".",".."))){
			$size+= filesize($dir."/".$file);
		}
	}
	return sizeFormat($size);
}

function sizeFormat($size) 
{ 
    if($size<1024) 
    { 
        return $size." bytes"; 
    } 
    else if($size<(1024*1024)) 
    { 
        $size=round($size/1024,1); 
        return $size." KB"; 
    } 
    else if($size<(1024*1024*1024)) 
    { 
        $size=round($size/(1024*1024),1); 
        return $size." MB"; 
    } 
    else 
    { 
        $size=round($size/(1024*1024*1024),1); 
        return $size." GB"; 
    } 
} 
